<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>类型判断</title>
</head>
<body>
    <script>
        // typeof
        let a = 3;
        console.log(typeof(a));

        let b = 'jwfqwjke';
        console.log(typeof(b));

        let arr = [1,2,3,4];
        console.log(typeof(arr));

        let obj = {};
        console.log(typeof(obj));

        function test(){};
        test();
        console.log(typeof(test));

        let xiasnn;
        console.log(typeof(xiasnn));

        // if(typeof(xiasnn) === 'undefined'){
        //     throw new Error("该变量没有声明");
        // }


        // instanceof判断原型
        console.log(arr instanceof Array);

        console.log(obj instanceof Array);

        console.log(obj instanceof Object);
        

        function User(){};
        let xiaxia = new User();
        console.log(xiaxia instanceof User);
        console.log(xiaxia instanceof Array);
        console.log(xiaxia instanceof Object);

    </script>
</body>
</html>